<?
class DataMediatorError {
	private $exception;
	public function __construct(Exception $exception) {
		if (
			!$exception instanceof ConverterException &&
			!$exception instanceof ValidatorException
		)
			throw new InvalidArgumentException('ConverterException or ValidatorException needed to create a DataMediatorError object.');
		$this->exception= $exception;
	}
	public function getErrorMessage() {
		return $this->exception->getErrorMessage();
	}
	public function isConverter(Converter $converter) {
		if ($this->exception instanceof ConverterException)
			return $this->exception->getConverter()=== $converter;
		return false;
	}
	public function isValidator(Validator $validator) {
		if ($this->exception instanceof ValidatorException)
			return $this->exception->getValidator()=== $validator;
		return false;
	}
	public function getException() {
		return $this->exception;
	}
	public function __toString() {
		return $this->getErrorMessage();
	}
}